home *** CD-ROM | disk | FTP | other *** search
- on highlighter
- global Subject, religion
- set subjectCount to the height of sprite 19 / 8
- set subjectNum to (the mouseV - the top of sprite 19) / subjectCount
- if subjectNum >= 8 then
- set subjectNum to 8
- end if
- set the locV of sprite 20 to the top of sprite 19 + (subjectCount * subjectNum) + subjectNum
- set Subject to ChooseSubject(subjectNum)
- put religion & Subject into field "store"
- end
-
- on divideMe
- global religion, Subject
- set religionNum to (the mouseH - the left of sprite 18) / 78
- if (religionNum = 5) or (religionNum < 1) then
- if religionNum > 7 then
- set religionNum to 7
- end if
- set sprtH to the left of sprite 18 + (78 * religionNum) + (the width of sprite 19 / 2) - 9
- set the locH of sprite 19 to sprtH
- set religion to ChooseReligion(religionNum)
- repeat while the stillDown
- if the mouseV >= 396 then
- set Subject to "bla"
- set the castNum of sprite 20 to 451
- set the foreColor of sprite 20 to 249
- set the width of sprite 20 to 73
- set the height of sprite 20 to 73
- set the locV of sprite 20 to 403
- set the locV of sprite 19 to 202
- set the locH of sprite 20 to the locH of sprite 19 - 35
- else
- highlighter()
- set the castNum of sprite 20 to 511
- set the foreColor of sprite 20 to 249
- set the width of sprite 20 to 67
- set the height of sprite 20 to 48
- set the locH of sprite 20 to the locH of sprite 19 - 33
- end if
- updateStage()
- end repeat
- else
- userAlert("You can only explore Islam in this demonstration version of Sources of Faith.")
- end if
- end
-
- on ChooseReligion religionNum
- global religion, dontDoMe
- set the puppet of sprite 24 to 1
- set the locH of sprite 24 to 800
- set the locH of sprite 23 to 800
- set dontDoMe to 1
- if religionNum < 1 then
- puppetSprite(17, 1)
- puppetSprite(21, 1)
- puppetSprite(22, 1)
- set the locH of sprite 17 to 800
- set the locH of sprite 19 to 800
- set the locV of sprite 20 to 800
- set the locH of sprite 21 to 800
- set the locV of sprite 22 to 800
- set the castNum of sprite 18 to 452
- set dontDoMe to 0
- return religion
- else
- if religionNum = 1 then
- return "Anim"
- else
- if religionNum = 2 then
- return "Budd"
- else
- if religionNum = 3 then
- return "Chri"
- else
- if religionNum = 4 then
- return "Hind"
- else
- if religionNum = 5 then
- return "Isla"
- else
- if religionNum = 6 then
- return "Juda"
- else
- if religionNum = 7 then
- return "Tao"
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end
-
- on ChooseSubject subjectNumber
- global Subject, dontDoMe
- set subjectNumber to subjectNumber + 1
- if subjectNumber < 9 then
- set the height of sprite 20 to 46
- set the width of sprite 20 to 46
- set the locH of sprite 20 to the locH of sprite 20
- else
- set the width of sprite 20 to 70
- set the height of sprite 20 to 70
- end if
- if subjectNumber = 1 then
- return "Gods"
- else
- if subjectNumber = 2 then
- return "life"
- else
- if subjectNumber = 3 then
- return "Ethi"
- else
- if subjectNumber = 4 then
- return "cult"
- else
- if subjectNumber = 5 then
- return "fest"
- else
- if subjectNumber = 6 then
- return "wher"
- else
- if subjectNumber = 7 then
- return "vari"
- else
- if subjectNumber = 8 then
- return "intr"
- else
- if (subjectNumber = 9) or (subjectNumber = 10) then
- if dontDoMe = 1 then
- set Subject to "bla"
- return Subject
- else
- if dontDoMe = 0 then
- return Subject
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end
-
- on checkWhereIam
- global IdleReligion, bgSound, OnorOff
- if (OnorOff = 1) and (soundBusy(1) = 0) then
- sound playFile 1, string(bgSound)
- end if
- if the castNum of sprite 18 = 449 then
- if IdleReligion = "Anim" then
- set whichReligion to 1
- else
- if IdleReligion = "Budd" then
- set whichReligion to 2
- else
- if IdleReligion = "Chri" then
- set whichReligion to 3
- else
- if IdleReligion = "Hind" then
- set whichReligion to 4
- else
- if IdleReligion = "Isla" then
- set whichReligion to 5
- else
- if IdleReligion = "Juda" then
- set whichReligion to 6
- else
- if IdleReligion = "Tao" then
- set whichReligion to 7
- else
- set whichReligion to 0
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- if whichReligion > 0 then
- sizeMe()
- set the locH of sprite 20 to the left of sprite 18 + (78 * whichReligion) - 12
- else
- set the locH of sprite 20 to 800
- end if
- end if
- end
-
- on sizeMe
- set the castNum of sprite 20 to 451
- set the foreColor of sprite 20 to 249
- set the width of sprite 20 to 73
- set the height of sprite 20 to 73
- set the locV of sprite 20 to 403
- end
-
- on textFlipper
- set it to the locH of sprite 24
- if the locH of sprite 24 > 700 then
- set the puppet of sprite 24 to 1
- set the locH of sprite 24 to 115
- set the locV of sprite 24 to 32
- set the locH of sprite 23 to 115
- set the puppet of sprite 17 to 1
- set the castNum of sprite 17 to 461
- set the locH of sprite 17 to 43
- set the locV of sprite 17 to 168
- else
- if the locH of sprite 24 < 800 then
- set the puppet of sprite 24 to 1
- set the locH of sprite 24 to 800
- set the locH of sprite 23 to 800
- set the castNum of sprite 17 to 454
- set the locH of sprite 17 to 43
- end if
- end if
- updateStage()
- end
-
- on Textoid textFieldNum
- set the castNum of sprite 24 to textFieldNum
- textFlipper()
- end
-
- on glossary glossWord
- global bodyOfText, label, default, gloss_texts, glossList
- set glossWord to lowercaseWord(unpossessive(trimWord(glossWord)))
- if glossWord <> EMPTY then
- cursor(4)
- if glossList = EMPTY then
- set glossList to getFileContent(gloss_texts & "SofIndex.txt")
- end if
- set glossFile to wordIsInGlossary(glossWord, glossList)
- if glossFile <> EMPTY then
- set glossPath to gloss_texts & glossFile
- set glossDef to getFileContent(glossPath)
- set the itemDelimiter to TAB
- set glossWord to item 1 of glossDef
- delete item 1 of glossDef
- set the itemDelimiter to ","
- glossAlert(glossWord, glossDef)
- else
- set glossWord to makeWordNotPlural(glossWord)
- if glossWord <> EMPTY then
- glossary(glossWord, EMPTY)
- end if
- end if
- cursor(-1)
- end if
- end
-
- on getFileContent fileName
- set the trace to 1
- set filer to FileIO(mnew, "read", fileName)
- set fileBuffer to EMPTY
- repeat while 1
- filer(mReadToken, EMPTY, RETURN)
- set fileLine to trimString(the result)
- if fileLine = EMPTY then
- exit repeat
- next repeat
- end if
- put fileLine & RETURN after fileBuffer
- end repeat
- filer(mdispose)
- set the trace to 0
- return fileBuffer
- end
-
- on lowercaseWord TheWord
- if TheWord <> EMPTY then
- set wordLen to length(TheWord)
- repeat with i = 1 to wordLen
- set ascii to charToNum(char i of TheWord)
- if (ascii >= 65) and (ascii <= 90) then
- set ascii to ascii + 32
- put numToChar(ascii) into char i of TheWord
- end if
- end repeat
- end if
- return TheWord
- end
-
- on makeWordNotPlural TheWord
- if TheWord <> EMPTY then
- set wordLen to length(TheWord)
- if "Ss" contains char wordLen of TheWord then
- delete char wordLen of TheWord
- else
- set TheWord to EMPTY
- end if
- end if
- return TheWord
- end
-
- on unpossessive TheWord
- if TheWord <> EMPTY then
- set wordLen to length(TheWord)
- if "Ss" contains char wordLen of TheWord then
- if "'`´‘’²" contains char wordLen - 1 of TheWord then
- delete char wordLen of TheWord
- delete char wordLen - 1 of TheWord
- end if
- end if
- end if
- return TheWord
- end
-
- on wordIsInGlossary TheWord, theList
- set wordFile to EMPTY
- if (TheWord <> EMPTY) and (theList <> EMPTY) then
- set lineCount to the number of lines in theList
- set the itemDelimiter to TAB
- if lineCount = 1 then
- if item 1 of line 1 of theList = TheWord then
- set wordFile to item 2 of line 1 of theList
- end if
- else
- if lineCount <= 8 then
- repeat with i = 1 to lineCount
- if item 1 of line i of theList = TheWord then
- set wordFile to item 2 of line i of theList
- exit repeat
- end if
- end repeat
- else
- set l to 1
- set h to lineCount
- repeat while l <= h
- set m to (l + h) / 2
- if TheWord < item 1 of line m of theList then
- set h to m - 1
- next repeat
- end if
- if TheWord > item 1 of line m of theList then
- set l to m + 1
- next repeat
- end if
- set wordFile to item 2 of line m of theList
- exit repeat
- end repeat
- end if
- end if
- set the itemDelimiter to ","
- end if
- return wordFile
- end
-
- on trimWord TheWord
- repeat while TheWord <> EMPTY
- set ascii to charToNum(char 1 of TheWord)
- if ((ascii >= 65) and (ascii <= 90)) or ((ascii >= 97) and (ascii <= 122)) then
- exit repeat
- next repeat
- end if
- delete char 1 of TheWord
- end repeat
- repeat while TheWord <> EMPTY
- set wordLen to length(TheWord)
- set ascii to charToNum(char wordLen of TheWord)
- if ((ascii >= 65) and (ascii <= 90)) or ((ascii >= 97) and (ascii <= 122)) then
- exit repeat
- next repeat
- end if
- delete char wordLen of TheWord
- end repeat
- return TheWord
- end
-
- on trimString theStr
- repeat while theStr <> EMPTY
- if charToNum(char 1 of theStr) <= 32 then
- delete char 1 of theStr
- next repeat
- end if
- exit repeat
- end repeat
- repeat while theStr <> EMPTY
- set strLen to length(theStr)
- if charToNum(char strLen of theStr) <= 32 then
- delete char strLen of theStr
- next repeat
- end if
- exit repeat
- end repeat
- return theStr
- end
-
- on fatalError str
- global bodyOfText, label, default
- set label to "Fatal Error"
- set default to RETURN & RETURN & str
- if the machineType < 256 then
- Dialog("modal", "glossary", "from label,from default,cancel,default")
- else
- alert(label & RETURN & default)
- end if
- reallyQuit()
- end
-
- on userAlert str
- global bodyOfText, label, default
- set label to "Sources of Faith"
- set default to RETURN & RETURN & str
- if the machineType < 256 then
- Dialog("modal", "glossary", "from label,from default,cancel,default")
- else
- alert(label & RETURN & default)
- end if
- end
-
- on glossAlert TheWord, theDef
- global bodyOfText, label, default
- set label to TheWord
- set default to theDef
- if the machineType < 256 then
- Dialog("modal", "glossary", "from label,from default,cancel,default")
- else
- alert(label & ":" && default)
- end if
- end
-